/*
 * 文件名： MerchantSettledPabServiceImpl.java
 * 
 * 工程名称: bis-service
 *
 * Gopay
 *
 * 创建日期： 2018年1月3日
 *
 * Copyright(C) 2018, by www.gopay.com.cn Inc.All rights reserved.
 *
 * 原始作者: 宣广海
 *
 */
package com.gopay.bis.service.bank.impl.merchant;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.gopay.bis.manager.bank.merchant.MerchantSettledPabManager;
import com.gopay.common.Result;
import com.gopay.common.constants.bank.PabConstants;
import com.gopay.common.constants.proccode.ProcCodeConstants;
import com.gopay.common.domain.bank.MerchantSettledRequest;
import com.gopay.common.domain.bank.merchant.MerchantSettledOrgReqMsg;
import com.gopay.common.domain.bank.merchant.MerchantSettledOrgResMsg;
import com.gopay.common.domain.bank.merchant.MerchantSettledResMessage;
import com.gopay.common.domain.bank.merchant.contract.req.ContractAddReqMsg;
import com.gopay.common.domain.bank.merchant.contract.req.ContractDeleteReqMsg;
import com.gopay.common.domain.bank.merchant.contract.req.ContractEditReqMsg;
import com.gopay.common.domain.bank.merchant.contract.req.ContractPayFeeReqMsg;
import com.gopay.common.domain.bank.merchant.contract.req.ContractRelateReqMsg;
import com.gopay.common.domain.bank.merchant.contract.res.ContractAddResMsg;
import com.gopay.common.domain.bank.merchant.contract.res.ContractDeleteResMsg;
import com.gopay.common.domain.bank.merchant.contract.res.ContractEditResMsg;
import com.gopay.common.domain.bank.merchant.contract.res.ContractPayFeeResMsg;
import com.gopay.common.domain.bank.merchant.contract.res.ContractPayListResMsg;
import com.gopay.common.domain.bank.merchant.contract.res.ContractRelateResMsg;
import com.gopay.common.domain.bank.merchant.mer.req.MechantAddReqMsg;
import com.gopay.common.domain.bank.merchant.mer.req.MerchantDeleteReqMsg;
import com.gopay.common.domain.bank.merchant.mer.req.MerchantEditReqMsg;
import com.gopay.common.domain.bank.merchant.mer.res.MerchantAddResMsg;
import com.gopay.common.domain.bank.merchant.mer.res.MerchantCityResMsg;
import com.gopay.common.domain.bank.merchant.mer.res.MerchantClassResMsg;
import com.gopay.common.domain.bank.merchant.mer.res.MerchantDeleteResMsg;
import com.gopay.common.domain.bank.merchant.mer.res.MerchantEditResMsg;
import com.gopay.common.domain.bank.merchant.shop.req.ShopAddReqMsg;
import com.gopay.common.domain.bank.merchant.shop.req.ShopDeleteReqMsg;
import com.gopay.common.domain.bank.merchant.shop.req.ShopEditReqMsg;
import com.gopay.common.domain.bank.merchant.shop.req.ShopOpenIdReqMsg;
import com.gopay.common.domain.bank.merchant.shop.res.ShopAddResMsg;
import com.gopay.common.domain.bank.merchant.shop.res.ShopDeleteResMsg;
import com.gopay.common.domain.bank.merchant.shop.res.ShopEditResMsg;
import com.gopay.common.domain.bank.merchant.shop.res.ShopOpenIdResMsg;
import com.gopay.common.exception.GopayException;
import com.gopay.remote.bank.foundation.MerchantSettledRemoteService;

/**
 * 商户入驻平台-平安银行商户入驻业务处理
 *
 * @author 宣广海
 *
 * @version
 *
 * @since 2018年1月3日
 */
@SuppressWarnings("unchecked")
public class MerchantSettledPabServiceImpl implements MerchantSettledRemoteService {
	/**
	 * 日志对象
	 */
	private static Logger logger = LoggerFactory.getLogger(MerchantSettledPabServiceImpl.class);

	@Resource(name = "merSettledPabManager")
	private MerchantSettledPabManager merSettledPabManager;

	@Override
	public Result merchantAdd(MerchantSettledRequest<MechantAddReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<MerchantAddResMsg> resMsg = (MerchantSettledResMessage<MerchantAddResMsg>) merSettledPabManager
					.merchantAdd(request);
			logger.info("---商户入驻添加商户返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getMct_no())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2200);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;

	}

	@Override
	public Result merchantEdit(MerchantSettledRequest<MerchantEditReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<MerchantEditResMsg> resMsg = (MerchantSettledResMessage<MerchantEditResMsg>) merSettledPabManager
					.merchantEdit(request);
			logger.info("---商户入驻编辑商户返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getMct_no())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2201);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;

	}

	@Override
	public Result merchantDelete(MerchantSettledRequest<MerchantDeleteReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<MerchantDeleteResMsg> resMsg = (MerchantSettledResMessage<MerchantDeleteResMsg>) merSettledPabManager
					.merchantDelete(request);
			logger.info("---商户入驻删除商户返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& PabConstants.MERCHANT_STATUS_DELETE.equals(resMsg.getBody().getStatus())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2202);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;

	}

	@Override
	public Result merchantMctClass(MerchantSettledRequest request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<List<MerchantClassResMsg>> resMsg = (MerchantSettledResMessage<List<MerchantClassResMsg>>) merSettledPabManager
					.merchantClass(request);
			logger.info("---商户入驻商户分类返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2203);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

	@Override
	public Result merchantCitic(MerchantSettledRequest request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<List<MerchantCityResMsg>> resMsg = (MerchantSettledResMessage<List<MerchantCityResMsg>>) merSettledPabManager
					.merchantCity(request);
			logger.info("---商户入驻商户城市列表返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2204);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

	@Override
	public Result shopAdd(MerchantSettledRequest<ShopAddReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ShopAddResMsg> resMsg = (MerchantSettledResMessage<ShopAddResMsg>) merSettledPabManager
					.shopAdd(request);
			logger.info("---商户入驻添加门店返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getShop_no())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2205);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

	@Override
	public Result shopEdit(MerchantSettledRequest<ShopEditReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ShopEditResMsg> resMsg = (MerchantSettledResMessage<ShopEditResMsg>) merSettledPabManager
					.shopEdit(request);
			logger.info("---商户入驻编辑门店返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getShop_no())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2206);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;

	}

	@Override
	public Result shopDelete(MerchantSettledRequest<ShopDeleteReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ShopDeleteResMsg> resMsg = (MerchantSettledResMessage<ShopDeleteResMsg>) merSettledPabManager
					.shopDelete(request);
			logger.info("---商户入驻删除门店返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& PabConstants.MERCHANT_STATUS_DELETE.equals(resMsg.getBody().getStatus())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2207);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;

	}

	@Override
	public Result shopOpenId(MerchantSettledRequest<ShopOpenIdReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ShopOpenIdResMsg> resMsg = (MerchantSettledResMessage<ShopOpenIdResMsg>) merSettledPabManager
					.shopOpenId(request);
			logger.info("---商户入驻获取门店openId返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getOpen_id())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2208);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;

	}

	@Override
	public Result contractPayList(MerchantSettledRequest request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<List<ContractPayListResMsg>> resMsg = (MerchantSettledResMessage<List<ContractPayListResMsg>>) merSettledPabManager
					.contractPayList(request);
			logger.info("---商户入驻获取合同支付方式列表返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2209);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;

	}
	@Override
	public Result contractPayFee(MerchantSettledRequest<ContractPayFeeReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ContractPayFeeResMsg> resMsg = (MerchantSettledResMessage<ContractPayFeeResMsg>) merSettledPabManager
					.contractPayFee(request);
			logger.info("---商户入驻获取合同支付费率列表返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2210);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

	@Override
	public Result contractAdd(MerchantSettledRequest<ContractAddReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ContractAddResMsg> resMsg = (MerchantSettledResMessage<ContractAddResMsg>) merSettledPabManager
					.contractAdd(request);
			logger.info("---商户入驻添加合同返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getCtt_id())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2211);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	
	}

	@Override
	public Result contractEdit(MerchantSettledRequest<ContractEditReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ContractEditResMsg> resMsg = (MerchantSettledResMessage<ContractEditResMsg>) merSettledPabManager
					.contractEdit(request);
			logger.info("---商户入驻编辑合同返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getCtt_id())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2212);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

	@Override
	public Result contractDelete(MerchantSettledRequest<ContractDeleteReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ContractDeleteResMsg> resMsg = (MerchantSettledResMessage<ContractDeleteResMsg>) merSettledPabManager
					.contractDelete(request);
			logger.info("---商户入驻删除合同返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& PabConstants.MERCHANT_STATUS_DELETE.equals(resMsg.getBody().getStatus())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2213);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

	@Override
	public Result contractRelateShop(MerchantSettledRequest<ContractRelateReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<ContractRelateResMsg> resMsg = (MerchantSettledResMessage<ContractRelateResMsg>) merSettledPabManager
					.contractRelateShop(request);
			logger.info("---商户入驻合同关联门店返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getCtt_id())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2214);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

	@Override
	public Result uplodeFile(MerchantSettledRequest<MerchantSettledOrgReqMsg> request) throws GopayException {
		/**
		 * 定义返回对象
		 */
		Result result = new Result(false);
		try {
			MerchantSettledResMessage<MerchantSettledOrgResMsg> resMsg = (MerchantSettledResMessage<MerchantSettledOrgResMsg>) merSettledPabManager
					.uplodeFile(request);
			logger.info("---上传文件返回对象：" + ToStringBuilder.reflectionToString(resMsg));
			if (resMsg != null) {
				if (PabConstants.SUCCESS.equals(resMsg.getErrcode())
						&& StringUtils.isNotBlank(resMsg.getBody().getFile_path())) {
					result.setDefaultModel(resMsg);
					result.setSuccess(true);
					// 接收成功
					result.setModel("falg", true);
				} else {
					result.setSuccess(false);
					result.setModel("falg", false);
					result.setResultCode(ProcCodeConstants.PROC_CODE_100E2215);
					result.setErrorMsg(resMsg.getMsg());
				}
			} else {
				result.setSuccess(false);
				result.setModel("falg", false);
				result.setResultCode(ProcCodeConstants.PROC_CODE_000F1002);
			}
		} catch (GopayException e) {
			throw new GopayException(e.getErrCode());
		} catch (Exception e) {
			throw new GopayException(ProcCodeConstants.PROC_CODE_000F1002);
		}
		return result;
	}

}
